package com.chinasofti.udp02;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class SendDemo {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();

        Scanner sc =new Scanner(System.in);
        while (true){
            System.out.println("键盘录入数据");
            String s =sc.nextLine();
            if("886".equals(s)){
                break;
            }
            byte []  bys = s.getBytes();
            DatagramPacket dp = new DatagramPacket(bys, bys.length, InetAddress.getByName("127.0.0.1"),12345);
            ds.send(dp);
        }

        ds.close();
    }
}
